<?php $aLocales = osc_get_locales() ; ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html dir="ltr" lang="<?php echo str_replace('_', '-', osc_current_user_locale()) ; ?>">
    <head>
        <?php osc_current_web_theme_path('head.php') ; ?>
        <meta name="robots" content="noindex, nofollow" />
        <meta name="googlebot" content="noindex, nofollow" />
        <script type="text/javascript">
            twitter_theme.text_select_subcategory = "<?php _e('Select a subcategory...', 'twitter') ; ?>" ;
            twitter_theme.category_selected_id    = "<?php echo item_selected_category_id() ; ?>" ;
            twitter_theme.subcategory_selected_id = "<?php echo item_selected_subcategory_id() ; ?>" ;
            twitter_theme.max_number_photos       = <?php echo osc_max_images_per_item() ; ?> ;
            twitter_theme.photo_remove_text       = "<?php _e('Remove', 'twitter') ; ?>" ;
	    twitter_theme.photo_label_info        = "<?php _e('Select Photo', 'twitter') ; ?>" ;
            twitter_theme.max_images_fields_txt   = "<?php _e('Sorry, you have reached the maximum number of images per ad',  'twitter') ; ?>" ;
            twitter_theme.country_select_id       = "<?php echo get_country_id((osc_item() != null) ? osc_item() : array()) ; ?>" ;
            twitter_theme.region_select_id        = "<?php echo get_region_id((osc_item() != null) ? osc_item() : array()) ; ?>" ;
            twitter_theme.city_select_id          = "<?php echo get_city_id((osc_item() != null) ? osc_item() : array()) ; ?>" ;
            twitter_theme.ajax_url                = "<?php echo osc_base_url(true) . '?page=ajax' ; ?>" ;
            twitter_theme.text_select_country     = "<?php _e('Select a country...', 'twitter') ; ?>" ;
            twitter_theme.text_select_region      = "<?php _e('Select a region...', 'twitter') ; ?>" ;
            twitter_theme.text_select_city        = "<?php _e('Select a city...', 'twitter') ; ?>" ;
            twitter_theme.text_no_regions         = "<?php _e('No regions available', 'twitter') ; ?>" ;
            twitter_theme.text_no_cities          = "<?php _e('No cities available', 'twitter') ; ?>" ;
            twitter_theme.page                    = "form" ;
            twitter_theme.item_id                 = "" ;
        </script>
        <?php item_category_select_js() ; ?>
        <script type="text/javascript" src="<?php echo osc_current_web_theme_js_url('bootstrap-tabs.js') ; ?>"></script>
        <script type="text/javascript" src="<?php echo osc_current_web_theme_js_url('item_form.js') ; ?>"></script>
		 
<script type="text/javascript" src="<?php echo osc_current_web_theme_js_url('item_post.js') ; ?>"></script>
<script type="text/javascript">		
function LoadAttributes(){	
   
    var cat_id=$("input[name='catId']").val();
   
        $.ajax({
            type: "POST",
            url: twitter_theme.ajax_url,
            data: { action: "runhook", hook: "item_" + twitter_theme.page, catId: cat_id, itemId: twitter_theme.item_id } ,
            dataType: 'html',
            success: function(data){
                $("#plugin-hook").html(data);  
                
                  $("input[name='catId']").unbind('click');
                  
                  $("input[name='catId']").change(function () {
                   //var type = VeicleTypeWrapper($(this).val());  

                     $(".radio").removeClass("labelSelected");
                     $(this).parent().addClass("labelSelected");

                    validateFirst($(this).val());
                   });
                   $("input[name='catId']").click(function () {
                      $(this).trigger('change');
                   });
               
            }
        });
        
       
}

function fillVeicleModel(type_id){
   
    $("#car_type").val(type_id);    
    
    var url = '<?php echo osc_ajax_plugin_url("cars_attributes/ajax.php") . "&typeId="; ?>' + type_id;
    var result = '';
    if(type_id != '') {
        $("#make").attr('disabled',false);
        $.ajax({
            type: "POST",
            url: url,
            dataType: 'json',
            success: function(data){
                var length = data.length;
                if(length > 0) {
                    result += '<option value=""><?php _e("Select a make", 'cars_attributes'); ?></option>';
                    for(key in data) {
                        result += '<option value="' + data[key].pk_i_id + '">' + data[key].s_name + '</option>';
                    }
                     result += '<option value="-1"><?php _e("Others", 'cars_attributes'); ?></option>';
                } else {
                    result += '<option value=""><?php _e('No results', 'cars_attributes'); ?></option>';
                    ("#makePnl").css("display","none");
                    $("#titleAuxPnl").css("display","");
                }
                $("#make").html(result);
            }
         });
     }    
    
}		

$(document).ready(function() { 	

    $("input[name='catId']").click(function () {
        $(this).attr("checked" , false );
    });
    LoadAttributes();
    $('#price').val('');
    numericInput('price');    	
});
</script>
		
</head>
<body>
        <?php osc_current_web_theme_path('header.php') ; ?>
	
        <div class="container item-post">
            <?php echo twitter_breadcrumb('&raquo;') ; ?>			
            <div class="container margin-top-10" style="width:660px;">
                    <?php twitter_show_flash_message() ; ?>
            </div>
            <div class="cajita-well">					
                <div class="cajita-wrapper">
                <form  name="item" action="<?php echo osc_base_url(true) ; ?>" method="post" enctype="multipart/form-data">		
                <input type="hidden" name="action" value="item_add_post" />
                <input type="hidden" name="page" value="item" />	
                <div class="cajita">
                    <div class="arrow"></div>
                       <div class="inner">

                            <h3 class="title">
                                    <?php _e('Publish your vehicle for free', 'twitter') ; ?><small></small>
                                    <span style="float:right;color:#BFBDBD;">
                                    <?php  _e('Step ','twitter');?><span id="step">1</span><?php _e(' of 4', 'twitter') ?>
                                    </span>
                            </h3>

                            <div class="content">
                                <div id="addTruckFirst">               

                                        <div class="control-group">
                                                <label class="control-label" for="Name">
                                                <span><?php _e('Mark vehicle type you want to buy or sell', 'twitter'); ?></span>
                                                <i class="icon-info-sign" title="<?php _e('Select your vehicle type here to continue', 'twitter'); ?>"></i>
                                                <p><span id="TypeVal" style="font-size:11pt" class="field-validation-valid" data-valmsg-replace="false" data-valmsg-for="type"><?php _e('Select your vehicle type to continue', 'twitter'); ?> &raquo;</span></p>   
                                                </label>
                                                <div id="catControl" class="controls clearfix" style="margin-left:200px;clear:none;">																
                                                        <?php  echo categories_icons_radio(); ?>
                                                </div>
                                        </div>		
                                        
                                        <div class="botonera" style="display:none;">										
                                                <input type="button" onclick="validateFirst()"  class="btn primary" value="<?php _e('Next', 'twitter'); ?> &raquo;" style="float:right;font-weight:bold;font-size:14px;"  />
                                        </div>
                                    
                                    <div class="clearfix"><br/><br/></div>
                                </div>      
                                <div id="addTruckSecond" style="display:none;margin-bottom:48px;">
                                        <h3><?php _e('Vehicle Attributes', 'twitter') ; ?></h3><br/>
                                        <div id="plugin-hook"></div>
                                        <div class="botonera" style="margin-top:20px;">
                                                 <input type="button" onclick="backFirst()"  class="btn" value="&laquo; <?php _e('Back', 'twitter'); ?>" style="float:left;font-weight:bold;font-size:14px;"  />
                                                <input type="button" onclick="validateSecond()"  class="btn primary" value="<?php _e('Next', 'twitter'); ?> &raquo;" style="float:right;font-weight:bold;font-size:14px;"  />
                                        </div>
                                 </div>
                                <div id="addTruckThird" style="display:none;margin-bottom:38px;">
                                                <h3><?php _e('Vehicle Details', 'twitter') ?></h3><br/>
                                                <?php if( osc_price_enabled_at_items() ) { ?>
                                                        <!-- price -->
                                                        <div class="clearfix">
                                                                <label for="price"><?php _e('Price', 'twitter') ; ?></label>
                                                                <div class="input">
                                                                        <?php item_price_input( ) ; ?>
                                                                        <?php item_currency_select( ) ; ?>
                                                                        <span class="help-block">
                                                                                <?php _e("<strong>Note:</strong> Leave it blank if you don't want to publish a price.", 'twitter') ; ?>
                                                                        </span>
                                                                </div>
                                                        </div>
                                                        <!-- price end -->
                                                 <?php } ?>
                                                  <div class="clearfix">
                                                        <label for="meta_item_vat"><?php _e('VAT', 'twitter') ; ?></label>
                                                        <div class="input">                                                            
                                                                <select name="meta[2]" id="item_vat">
                                                                    <option value=""><?php _e('Select kind of VAT', 'twitter'); ?></option>
                                                                    <option value="novatinprice"><?php _e('No VAT in price', 'twitter'); ?> </option>
                                                                    <option value="addvattoprice"><?php _e('Add +VAT to price', 'twitter'); ?> </option>
                                                                    <option value="partlyvatinprice"><?php _e('Price with partly VAT', 'twitter'); ?> </option>
                                                                    <option value="nopayedregistrationtax"><?php _e('No payed registration tax', 'twitter'); ?> </option>                                                                        
                                                                    <option value="exportonlyvatisdrawn"><?php _e('Export only VAT is drawn', 'twitter'); ?> </option>
                                                                </select>
                                                        </div>
                                                </div>
                                                <div class="clearfix">
                                                        <div class="clearfix">
                                                                <label>
                                                                <input type="checkbox" name="meta[3]" id="item_b2b" /> 
                                                                </label>
                                                                <label style="margin-left:15px;text-align:left;width:55%;"><?php _e('Mark if only B2B sale where both parts have a VAT number', 'twitter'); ?></label>

                                                        </div>
                                                </div>
                                                  <!-- title and description -->
                                                <div class="clearfix">												
                                                        <?php item_description_box(__('Additional Information', 'twitter'), $aLocales) ; ?>
                                                </div>
                                                <div style="display:none;"><?php item_title_box($aLocales) ; ?></div>
                                                <!-- title and description end -->	

                                                <hr>
                                                 <!-- location -->
                                                <h3><?php _e('Vehicle Location', 'twitter') ?></h3><br/>
                                                <?php item_country_box(__("Country", "twitter"), __("Select a country...", "twitter")) ; ?>
                                                <?php item_region_box(__("Region", "twitter"), __("Select a region...", "twitter"), osc_user()) ; ?>
                                                <?php item_city_box(__("City", "twitter"), __("Select a city...", "twitter"), osc_user()) ; ?>
                                              
                                                <!-- location end -->
                                         <div class="botonera">
                                                <input type="button" onclick="backSecond()"  class="btn" value="&laquo; <?php _e('Back', 'twitter'); ?>" style="float:left;font-weight:bold;font-size:14px;"  />
                                                <input type="button" onclick="validateThird()"  class="btn primary" value="<?php _e('Next', 'twitter'); ?> &raquo;" style="float:right;font-weight:bold;font-size:14px;"  />
                                        </div>
                                 </div>
                                <div id="addTruckFourth" style="display:none;margin-bottom:38px;">		
                                         <?php if( osc_images_enabled_at_items() ) { ?>
                                                <!-- photo -->
                                                <h3><?php _e('Your vehicle pictures', 'twitter') ; ?> </h3>
                                                <p><strong style="color:#286DA3;margin-left:90px;"><?php _e('Give more visibility to your ad by adding some pictures.', 'twitter') ;?></strong></p>
                                                <br/>
                                                <div class="clearfix photos">
                                                        <label for="photos[]"><?php _e('Select Photo', 'twitter') ; ?></label>
                                                        <div class="input input-file" >
                                                                <input type="file" name="photos[]" size="35" />
                                                        </div>
                                                        <div class="more-photos">

                                                        </div>
                                                        <br/>
                                                        <div class="input">
                                                                <a href="javascript://" onclick="return add_photo_field();">[ <?php _e('Add new photo', 'twitter'); ?> ]</a>
                                                        </div>
                                                </div>

                                                <!-- photo end -->
                                        <?php } ?>
                                        <hr/>

                                        <!-- seller -->
                                        <h3><?php _e("Seller's information", "twitter"); ?></h3>
                                        <br/>
                                        <div class="clearfix">
                                                <label><?php _e('Name', 'twitter') ; ?></label>
                                                <div class="input">
                                                        <?php echo item_contact_name_input_publish() ; ?>
                                                </div>
                                        </div>
                                        <div class="clearfix">
                                                <label><?php _e('E-mail', 'twitter') ; ?></label>
                                                <div class="input">
                                                        <?php echo item_contact_mail_input_publish() ; ?>
                                                </div>
                                        </div>
                                        
                                         <div class="clearfix">
                                                <label for="meta_item_gsmphone"><?php _e('GSM Car Phone', 'twitter') ; ?></label>
                                                <div class="input">
                                                        <input id="meta_item_gsmphone" type="text" value="<?php echo osc_user_phone(); ?>" name="meta[4]" />
                                                </div>
                                        </div>
                                        
                                        <div class="clearfix">
                                                <label for="meta_item_phone"><?php _e('Phone', 'twitter') ; ?></label>
                                                <div class="input">
                                                        <input id="meta_item_phone" type="text" value="<?php echo osc_user_phone_mobile(); ?>" name="meta[1]" />
                                                </div>
                                        </div>
                                        
                                       

                                        <div class="clearfix">
                                                <div class="input">
                                                        <ul class="inputs-list">
                                                                <li>
                                                                        <label for="showEmail">
                                                                                <?php echo item_contact_show_email_checkbox_publish() ; ?>
                                                                                <span><?php _e('Show phone contact on the item page', 'twitter'); ?></span>
                                                                        </label>
                                                                </li>
                                                        </ul>
                                                </div>
                                        </div>																				
                                        <!-- seller end -->

                                        <div class="botonera">
                                                <input type="button" onclick="backThird()"  class="btn" value="&laquo; <?php _e('Back', 'twitter'); ?>" style="float:left;font-weight:bold;font-size:14px;"  />
                                                <input type="submit" onclick="Loading()"  class="btn success" value="<?php _e('Finish', 'twitter'); ?>" style="float:right;font-weight:bold;font-size:14px;"  />											
                                        </div> 
                                 </div>									 
                            </div>								
                       </div>
                </div>
                </form>	
                <div id="summary">
                    <ul class="breadcrumb" style="width:634px;margin:0 auto;margin-bottom:10px;">
                        <i class="icon-th-large" title="<?php _e('Summary', 'twitter') ; ?>"></i> 
                        <?php _e('Summary', 'twitter') ; ?>   
                        <span class="divider">»</span>
                         <span id="summaryStr" style="font-weight:bold;">
                             
                         </span>
                    </ul>
                </div>
                </div>
            </div>
	
            <div class="progress progress-info progress-striped" style="width:660px; margin-left:auto; margin-right:auto;">
                    <div class="bar" id="progressBar" style="width: 0%;"></div>
            </div>
           
        </div>
       
        <script type="text/javascript">
            var text_error_required = '<?php _e('This field is required', 'twitter') ; ?>' ;
        </script>
       
        <?php osc_current_web_theme_path('footer.php') ; ?>
    </body>
</html>